﻿// Copyright (c) 2011 Vratislav Cermak (vratacermak@gmail.com)
//  
// This file is part of SrtSync Project. See http://code.google.com/p/srtsync/ for more information.
//  
// SrtSync is an open source project. Using of SrtSync is free of charge.
// It is distributed under GNU General Public License version 3 (GPLv3).
// GPLv3 can be found at http://www.gnu.org/licenses/gpl.html.
//  
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE.  See the license for more details.

using SrtSync.Core.Data;
using SrtSync.Core.Controllers;
using SrtSync.Core.Framework;
using SrtSync.Core.Notifications;
using SrtSync.GtkWidgets;

namespace SrtSync.GtkProgram
{
    static class Program
    {
        static void Main()
        {
            Gtk.Application.Init();
            
            IApplication application = new Application();
            
            // initialize view
            MainWindow applicationWindow = new MainWindow();
            
            // initialize common dialogs
            IDialogs dialogs = new Dialogs(applicationWindow, application.Settings);
            
            // connect view with model
            applicationWindow.Attach(application);
            applicationWindow.Left.Attach(application.Left);
            applicationWindow.Right.Attach(application.Right);
                      
            // controllers
            new ApplicationController(application, dialogs, applicationWindow);
            new EditorController(application.Left, dialogs, applicationWindow.Left);
            new EditorController(application.Right, dialogs, applicationWindow.Right);

            // model will dispatch notification to its observers that we are ready to go
            application.Dispatch(ApplicationModelNotificationTypes.Start);
            
            Gtk.Application.Run();
        }
    }
}